<template>
  <el-dialog :title="title" :visible="visibleFlag" :width="width" :before-close="handleClose">
    <slot name="dialog-section"></slot>
    <span slot="footer" class="dialog-footer">
      <el-button class="el-green-button" size="mini" @click="handleSubmit">确 定</el-button>
      <el-button class="el-red-button" size="mini" @click="handleClose">取 消</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: 'addDialog',
  props: {
    visibleFlag: { type: Boolean, required: true },
    title: { type: String, default: '新增' },
    width: { type: String }
  },
  methods: {
    handleSubmit () {
      this.$emit('handleSubmit')
      this.handleClose()
    },
    handleClose () {
      this.$emit('update:visibleFlag', false)
    }
  }
}
</script>

<style>
</style>
